Imports TreeCreeper01Interfaces

Public Class fRandomisedRun

    'Just a window that invokes the run and then displays the results.

    Friend Sub DoABatchOfRuns(ByVal Study As IStudyNonSpatial, ByVal HowManyRuns As Integer, ByVal HowManySpecies As Integer, _
        ByVal UseAbundances As Boolean, ByVal Title As String)

        Dim Run As cRandomBatchRun
        Dim Textlines As String()
        Dim LineIndex As Integer
        Dim BatchIndex As Integer
        Dim OneDiversity As Double


        Text = Title
        TextReport.Text = "Working..."
        Show()
        Refresh()

        Run = New cRandomBatchRun
        With Run

            .DoABatchOfRuns(Study, HowManyRuns, HowManySpecies, UseAbundances)

            ReDim Textlines(HowManyRuns + 5)

            LineIndex = 0
            Textlines(LineIndex) = "Mean: " & CStr(.Mean)
            LineIndex += 1

            Textlines(LineIndex) = "SD: " & CStr(.StandardDeviation)
            LineIndex += 1

            For BatchIndex = 1 To .Count
                LineIndex += 1
                OneDiversity = .DiversityResultByIndexBaseOne(BatchIndex)
                Textlines(LineIndex) = CStr(OneDiversity)
            Next

        End With

        TextReport.Lines = Textlines

    End Sub

End Class